home *** CD-ROM | disk | FTP | other *** search
- Path: su3.in.net!news
- From: mave@in.net (John J. Maver)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Help me with a basic MUI program PLEASE?
- Date: 9 Jan 1996 11:35:32 GMT
- Organization: INTERNET Indiana
- Message-ID: <2440.6581T1279T1051@in.net>
- Reply-To: mave@in.net
- NNTP-Posting-Host: pm4-18.in.net
- X-Newsreader: THOR 2.22 (Amiga;TCP/IP)
-
-
-
- Could someone please help me with MUI? I have started trying to use
- MUIBuilder,and I can't seem to make a good main.c to control the code it
- generates. I am new to MUI. All I want to know is how to open the window and
- then when the person hits the close gadget, have the window close. With my
- existing main.c. the window opens and is open for good!!
-
- Is there a good reference for MUI? Some basic examples, not some 18 part
- multiprogram.
-
- Thank you for your help.
-
- Test.h and Test.c follow
-
-
- <tsb>
-
- /*******************/
- /* this is test.h */
- /*******************/
-
- #include <libraries/mui.h>
- #include <proto/muimaster.h>
- #include <clib/exec_protos.h>
- #include <exec/memory.h>
- #include <clib/alib_protos.h>
-
- struct ObjApp
- {
- APTR App;
- APTR WI_label_0;
- };
-
-
- extern struct ObjApp * CreateApp(void);
- extern void DisposeApp(struct ObjApp *);
-
-
- <sb>
-
- /****************/
- /*This is test.c*/
- /****************/
-
-
- #ifndef MAKE_ID
- #define MAKE_ID(a,b,c,d) ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 |
- (ULONG) (d))
- #endif
-
- #ifdef _DCC
- #define __inline
- #endif
-
- #include "Test.h"
-
- struct ObjApp * CreateApp(void)
- {
- struct ObjApp * Object;
-
- APTR MainWin, TheLabel;
-
- if (!(Object = AllocVec(sizeof(struct ObjApp), MEMF_PUBLIC|MEMF_CLEAR)))
- return(NULL);
-
- TheLabel = Label("LableTitle");
-
- MainWin = GroupObject,
- Child, TheLabel,
- End;
-
- Object->WI_label_0 = WindowObject,
- MUIA_Window_Title, "window_title",
- MUIA_Window_ID, MAKE_ID('0', 'W', 'I', 'N'),
- WindowContents, MainWin,
- End;
-
- Object->App = ApplicationObject,
- MUIA_Application_Author, "Me",
- MUIA_Application_Base, "Test",
- MUIA_Application_Title, "Test",
- MUIA_Application_Version, "$VER: NONE XX.XX (XX.XX.XX)",
- MUIA_Application_Copyright, "NOBODY",
- MUIA_Application_Description, "Test",
- SubWindow, Object->WI_label_0,
- End;
-
-
- if (!Object->App)
- {
- FreeVec(Object);
- return(NULL);
- }
-
- DoMethod(Object->WI_label_0,
- MUIM_Window_SetCycleChain, 0
- );
-
- set(Object->WI_label_0,
- MUIA_Window_Open, TRUE
- );
-
-
- return(Object);
- }
-
- void DisposeApp(struct ObjApp * Object)
- {
- MUI_DisposeObject(Object->App);
- FreeVec(Object);
- }
-
-
-
- --
- <tsb> John J. Maver
- <sb> A4000/040
- You are faithful to duty, adaptable to environment, loyal to friends.
-
-